package com.mach.platform.api.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class ApiConfiguration implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 拦截所有的微信第三方接口请求(/api/**)
        registry.addInterceptor(apiInterceptor()).addPathPatterns("/api/**");
    }


    @Bean
    public ApiInterceptor apiInterceptor() {
        return new ApiInterceptor();
    }

}
